package edu.uoc.tfc.web.tags;



import javax.servlet.jsp.JspWriter;

import org.apache.commons.lang.StringUtils;



public abstract class AbstractButtonTag extends EmktBaseTag 
{
    private static final long serialVersionUID = 1L;

	public final static String STYLE_DEFAULT = "";
	public final static String STYLE_PRIMARY = "btn-primary";
	public final static String STYLE_INFO    = "btn-info";
	public final static String STYLE_SUCCESS = "btn-success";
	public final static String STYLE_WARNING = "btn-warning";
	public final static String STYLE_DANGER  = "btn-danger";



    protected String style = STYLE_DEFAULT;
    protected String label;
    protected String targetDiv;
    protected String service;
    protected String operation;
    protected String modalClass;
    protected String iconClass;
	private boolean bytoken = false;



	protected abstract String getClassMode();

	protected abstract String getTypeMode();

	protected abstract String getData();
	
	protected abstract void writeButton(JspWriter out) throws Exception;



	public String getLabel() {
    	return label;
    }

	public void setLabel(String label) {
    	this.label = label;
    }



    public String getTargetDiv() {
    	return targetDiv;
    }

	public void setTargetDiv(String targetDiv) {
    	this.targetDiv = targetDiv;
    }



	public String getService() {
    	return service;
    }

	public void setService(String service) {
    	this.service = service;
    }



	public String getOperation() {
    	return operation;
    }

	public void setOperation(String operation) {
    	this.operation = operation;
    }



	public String getModalClass() {
		return modalClass;
	}

	public void setModalClass(String modal) {
		this.modalClass = modal;
	}



	public String getStyle() {
    	return style;
    }

	public void setStyle(String style) {
    	this.style = style;
    }



	public String getIconClass()
	{
		if (iconClass == null)
		{
			return iconClass;
		}
		else
		if (StringUtils.equals(getStyle(), STYLE_DEFAULT))
		{
			return iconClass;
		}
		else
		{
			return "icon-white " + iconClass;
		}
	}

	public void setIconClass(String iconClass) {
		this.iconClass = iconClass;
	}



	public boolean getBytoken() {
		return bytoken;
	}

	public void setBytoken(boolean bytoken) {
		this.bytoken = bytoken;
	}

	public String getContextPath(){
		return super.getContextPath();
	}

}
